
//初始化
// 数据处理

var $Data_userName = sessionStorage.getItem('userName');
var $Data_islogin = sessionStorage.getItem('isLogin');
var $publicVar_Obj;//当前位置










// var uersName = 'Ariza';
// var reditIdsave; //临时ID保存
// var deleteIdsave; //临时ID保存
// var contentBoxIdArray = []; //基础内容栏的ID组
// var classIdJs;

// var nowPage = 0;
// var showNum = 10;


window.onload = function () {
  inLine();
};

window.addEventListener('scroll', (event) => {
  var scrollT =document.body.scrollTop || document.documentElement.scrollTop;
  if (scrollT >= 200) {
     $rightNav_Btm_top.classList.add('showUp')
  }else{
    $rightNav_Btm_top.classList.remove('showUp')
  }
})

//登录判断
const inLine = () => {
  if ($Data_islogin == 'yes') {
    $H_fn_headshowup();
    return;
  }
  //暂存中的初始化设定
  sessionStorage.setItem("userName", "zkqzwxec22");
  sessionStorage.setItem("userPwd", "liushangji22");
  sessionStorage.setItem("isLogin", "no");
  localStorage.setItem(sessionStorage.getItem('userName') + 'CIdArr', '');
}


//获取当前时间
function DateN() {
  var timedate = new Date();
  var Year = timedate.getFullYear();
  var Month = timedate.getMonth() + 1;//.getMonth() 需要 +1 
  var Dates = timedate.getDate();
  var Day = timedate.getDay();//周几     //周一到周六返回 1-6  周日是 0
  var Hours = timedate.getHours();
  Hours=Hours<=9?'0'+Hours:Hours;
  var Minutes = timedate.getMinutes();
  Minutes=Minutes<=9?'0'+Minutes:Minutes;
  var Seconds = timedate.getSeconds();
  Seconds=Seconds<=9?'0'+Seconds:Seconds;
  var arrDay = ['日', '一', '二', '三', '四', '五', '六']
  return Year + '-' + Month + '-' + Dates + ' ' + Hours + ':' + Minutes + ':' + Seconds
}

//获取用户的组ID,用缓存中的userName，传到后端，后端再把处理后的ID放在一个数组中传过来
var userClassIdArr = () => { 
  let CIda = localStorage.getItem($Data_userName + 'CIdArr');
  if (CIda == null) {
    return CIda;
  }
  let userClassIdAr = createArr(CIda, 0, 4, 4);
  return userClassIdAr; //IDarr[]
}

//剪切一段字符，将其添加进一个数组中
const createArr = (str, start, end, unit) => {
  let arr = [];
  let counts = Math.ceil(str.length / unit);
  for (var i = 0; i < counts; i++) {
    let newStr = str.substring(start, end);
    arr.push(newStr);
    start = end;
    end += unit
  }
  return arr;
}

//将字符串 按照分隔符进行分割
const createStr = (str,icon) =>{
  let strArr = str.split(icon);
  let newStrArr = [];
  for(var i = 0;i<strArr.length;i++){
    if(strArr[i]!=''){
      newStrArr.push(strArr[i])
    }
       
  }
  return newStrArr;
}
